/**
 * @author zhgk
 * @date ${DATE}
 * @decription
 **/
package com.yg.ssm.hello.ctrl;

import com.yg.ssm.hello.model.TestModel;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2016/8/25.
 */
@Controller
public class HelloWorld {
    //返回JSP页面
//    @RequestMapping("/")
//    public String hello(Model model) {
//        System.out.println("rsqgb");
//        model.addAttribute("name", "zhangsan");
//        return "index";
//    }
    //返回消息
    @RequestMapping("/string")
    @ResponseBody
    public String helloWorld() {
        return "helloWorld";
    }

    //返回JSON
    @RequestMapping("/map")
    @ResponseBody
    public Map getMap() {
        TestModel t = new TestModel();
        Map mp = new HashMap();
        mp.put("username", "lisi");
        return mp;


    }

}
